package com.syqc.comlib.utils

import android.content.Context

/**
 *@Author Jasper
 *@Time   2020/11/3
 *@Desc   todo
 */
object AppContext {
    private var appContext: Context? = null
    fun getAppContext(): Context {
        if (appContext == null) throw Exception("appContext  not initialized")
        return appContext!!
    }

    fun setAppContext(appContext: Context) {
        AppContext.appContext = appContext
    }

    fun getDescById(stringId: Int): String {
        return getAppContext().getString(stringId)
    }
    fun getArrayById(stringId: Int)=getAppContext(). resources.getStringArray(stringId)
}